﻿using System;

namespace smp.RabbitMq
{
    public interface IRequester : IDisposable
    {
        /// <summary>
        /// Request a response to message
        /// </summary>
        /// <typeparam name="TMessage">message</typeparam>
        /// <typeparam name="TResponse">response</typeparam>
        /// <param name="message">message instance</param>
        /// <returns>response instance</returns>
        TResponse Request<TMessage, TResponse>(TMessage message);
        /// <summary>
        /// Request a response to message
        /// </summary>
        /// <typeparam name="TMessage">message</typeparam>
        /// <typeparam name="TResponse">response</typeparam>
        /// <param name="message">message instance</param>
        /// <param name="timeOutMilliSeconds">milliseconds before the wait for a response is aborted</param>
        /// <returns>response instance</returns>
        TResponse Request<TMessage, TResponse>(TMessage message, int timeOutMilliSeconds);
        /// <summary>
        /// Request a response to message
        /// </summary>
        /// <param name="messageType">type of message</param>
        /// <param name="message">message instance</param>
        /// <returns>response instance</returns>
        object Request(Type messageType, object message);
        /// <summary>
        /// Request a response to message
        /// </summary>
        /// <param name="messageType">type of message</param>
        /// <param name="message">message instance</param>
        /// <param name="timeOutMilliSeconds">milliseconds before the wait for a response is aborted</param>
        /// <returns>response instance</returns>
        object Request(Type messageType, object message, int timeOutMilliSeconds);
        /// <summary>
        /// Request a response to message
        /// </summary>
        /// <param name="assemblyQualifiedMessageType">type of message</param>
        /// <param name="message">message instance</param>
        /// <returns>response instance</returns>
        object Request(string assemblyQualifiedMessageType, string message);
        /// <summary>
        /// Request a response to message
        /// </summary>
        /// <param name="assemblyQualifiedMessageType">type of message</param>
        /// <param name="message">message instance</param>
        /// <param name="timeOutMilliSeconds">milliseconds before the wait for a response is aborted</param>
        /// <returns>response instance</returns>
        object Request(string assemblyQualifiedMessageType, string message, int timeOutMilliSeconds);
    }
}
